{{extend "new_layout.html",layout='bootstrap/fluid_layout.html'}}

{{block content_main}}
{{use "jquery"}}
{{use "jqutils"}}
<style>
    #forum_tops {padding:5px;}
    #forum_tops li, #links li {list-style:none; padding:4px 0;}
    #forum_tops li em {color:#999;}
    #forum_tops li a {text-decoration:none;}
    #forum_tops li a:hover {text-decoration:underline;}
</style>
<script type="text/html" id="topicTemplate">
    <li>
        <a href="/forum/${forum}/${id}">${subject}</a> <em>${posted_by}</em> <em>${created_on}</em>
    </li>
</script>
<div class="hero-unit">
    <div class="inner">
      <h1>FLPM-全生命周期开发实施过程管理</h1>
      <p>愿意成为您决策的助手，沟通的桥梁<br/>
        FLPM（http://11.140.160.45:1280），永远因您而改变
      </p>
    </div>
</div>
<div class="row">
    <div class="span16">
        <h2>论坛公告</h2>
        <div id="forum_tops">
            <div>正在装入...</div>
        </div>
    </div>
</div>
<script type="text/javascript">
    var load_topics = function(){
        $.ajax({
            type: "GET",
            dataType: 'json',
            url: "/forum_tops",
            success: function(data){
                var forum = $('#forum_tops')
                forum.empty();
                var ul = $('<ul></ul>').appendTo(forum);
                $.each(data.rows, function(index, value){
                    var topic = template($('#topicTemplate').html(), value).appendTo(ul);
                });
            }
        });
    }
    $(function(){
        load_topics();
    });
</script>
{{end}}

{{block content_sidebar}}
<script type="text/html" id="linkTemplate">
    <li>
        <a href="${link}">${name}</a><em>${desc}</em></em>
    </li>
</script>
<div class="well" id="links">
  <h5>热点链接</h5>
  <div>正在装入...</div>
</div>
<script type="text/javascript">
var load_links = function(){
    $.ajax({
        type: "GET",
        dataType: 'json',
        url: "/portal/links",
        success: function(data){
            var links = $('#links')
            links.children('div').remove();
            var ul = $('<ul></ul>').appendTo(links);
            $.each(data.rows, function(index, value){
                var topic = template($('#linkTemplate').html(), value).appendTo(ul);
            });
        }
    });
}

var get_message_count=function(){
    $.ajax({
        type: "GET",
        url: "/config/messages/number",
        success: function(r){
            if (r.success == 'ok'){
                $('#messages_number').html(r.data);
                setTimeout(get_message_count,600000);
            }
        }
    });
}

$(function(){
    load_links();
    get_message_count();
    
});
</script>
{{end}}